﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/manage.master" AutoEventWireup="true" CodeFile="Gallery.aspx.cs" Inherits="Management_Common_Gallery" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link rel="stylesheet" href="<%=ResolveUrl("~/Scripts/swfupload/default.css") %>" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript" src="<%=ResolveUrl("~/Scripts/swfupload/handlers.js") %>"></script>
    <script type="text/javascript" src="<%=ResolveUrl("~/Scripts/swfupload/swfupload.js") %>"></script>
    <script language="javascript" type="text/javascript">
        var swfu;

        $(window).load(function () {
            Init_SWFUpload();
        });

        function Init_SWFUpload() {
            swfu = new SWFUpload({
                // Backend Settings
                upload_url: '<%=ResolveUrl("~/Management/upload.aspx") %>',
                post_params: {
                    "ASPSESSID": "<%=Session.SessionID %>"
                },

                // File Upload Settings
                file_size_limit: "2 MB",
                file_types: "*.jpg;*.gif",
                file_types_description: "Images",
                file_upload_limit: "0",    // Zero means unlimited

                // Event Handler Settings - these functions as defined in Handlers.js
                //  The handlers are not part of SWFUpload but are part of my website and control how
                //  my website reacts to the SWFUpload events.
                file_queue_error_handler: fileQueueError,
                file_dialog_complete_handler: fileDialogComplete,
                upload_progress_handler: uploadProgress,
                upload_error_handler: uploadError,
                upload_success_handler: uploadSuccess,
                upload_complete_handler: uploadComplete,

                // Button settings
                button_image_url: '<%=ResolveUrl("~/Scripts/swfupload/images/XPButtonNoText_160x22.png") %>',
                button_placeholder_id: "spanButtonPlaceholder",
                button_width: 160,
                button_height: 22,
                button_text: '<span class="button">选择图片<span class="buttonSmall">(单文件 2 MB)</span></span>',
                button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 12px; }',
                button_text_top_padding: 1,
                button_text_left_padding: 5,

                // Flash Settings
                flash_url: '<%=ResolveUrl("~/Scripts/swfupload/swfupload.swf") %>', // Relative to this file

                custom_settings: {
                    upload_target: "divFileProgressContainer"
                },

                // Debug Settings
                debug: false
            });
        }
    </script>
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" AsyncPostBackTimeout="36000">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <h2 class="clearfix">
                <span class="float_l">首页拼图</span>
            </h2>
            <asp:Panel ID="Panel1" runat="server" CssClass="block">
                <div id="uploader">
                    <span id="spanButtonPlaceholder"></span>(322*322)
                </div>
                <div id="divFileProgressContainer" style="height: 75px;"></div>
                <div id="thumbnails" style="display:none;padding:10px; background:#444; border:1px solid #3b3b3b;width:700px;margin-top:20px;">
                    <div id="file_list" style="display:none;margin-bottom:20px;font-weight:bold;">上传图片列表</div>
                </div>
                <div class="margin10_tb">
                    <asp:LinkButton ID="lbtnSave" runat="server" onclick="lbtnSave_Click" CssClass="btn">保存</asp:LinkButton>
                    <asp:LinkButton ID="lbtnCancel" runat="server" CssClass="btn" onclick="lbtnCancel_Click">取消</asp:LinkButton>
                </div>
            </asp:Panel>
            <div class="block">
                <asp:Repeater ID="Repeater1" runat="server">
                    <ItemTemplate>
                        <div class="picblock">
                            <div>
                                <asp:HyperLink ID="hlnkUrl" runat="server" NavigateUrl='<%#ResolveUrl(Eval("PicName").ToString()) %>' ToolTip='<%#Eval("PicName").ToString() %>' BorderWidth="0" Target="_blank">
                                    <img src='<%#ResolveUrl(Eval("PicName").ToString()) %>' alt='<%#Eval("PicName").ToString() %>' width="200" height="200" border="0" />
                                </asp:HyperLink>
                            </div>
                            <p><asp:CheckBox ID="chkCheck" runat="server" /><asp:TextBox ID="txtUrl" runat="server" CssClass="text" Text='<%#Eval("Url").ToString() %>'/></p>
                            <asp:HiddenField ID="hidPicID" Value='<%#Eval("ID").ToString() %>' runat="server" />
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                <div class="pager margin10_tb">
                <asp:Repeater ID="rptPageFliper" runat="server">
                    <ItemTemplate>
                        <span class='<%#(((PageNumberItem)Container.DataItem).IsCurrentPage) ? "current": string.Empty%>' class="paging">
                            <asp:LinkButton ID="lbtnPager" runat="server" CommandName="<%# ((PageNumberItem)Container.DataItem).PageNumberCommand%>"
                                Text="<%# ((PageNumberItem)Container.DataItem).PageNumberText%>" Enabled='<%# !(((PageNumberItem)Container.DataItem).IsCurrentPage) %>'
                                Style='<%#(((PageNumberItem)Container.DataItem).IsCurrentPage) ? "color:#eee;": "color:#eee;"%>'
                                Font-Underline="false"></asp:LinkButton>
                        </span>
                    </ItemTemplate>
                </asp:Repeater>
                </div>
                <div class="margin10_tb">
                    <asp:LinkButton ID="lbtnSaveEdit" runat="server" CssClass="btn" onclick="lbtnSaveEdit_Click">保存修改</asp:LinkButton>
                    <asp:LinkButton ID="lbtnDelete" runat="server" CssClass="btn" onclick="lbtnDelete_Click" OnClientClick="javascript:return confirm('确认删除么？');">删除选中的图片</asp:LinkButton>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

